import Vue from 'vue'
import VueRouter from 'vue-router'

// import Login from '@/views/Login'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    //redirect 重定向 到首页
    redirect:'/ ',
    component: () => import('@/views/Layout'),
    children:[
      //子路由path 如果不加/ 自动将父路由path个自己path进行拼接
      //加了 /  不会拼接
      {
        path:'/ ',
        component: () => import('@/views/Home')
      },
      {
        path:'/video',
        component: () => import(/* webpackChunkName: 'a' */ '@/views/Video')
      },
      {
        path:'/qa',
        component: () => import(/* webpackChunkName: 'a' */ '@/views/QA')
      },
      {
        path:'/profile',
        component: () => import('@/views/My')
      },
    ]
  },
  {
    path:'/login',
    component: () => import('@/views/Login')
  },
  //搜索页
  {
    path: '/search',
    component: () => import('@/views/Search')
  },
  //编辑页
  {
    path: '/user',
    component: () => import('@/views/User')
  }
]

const router = new VueRouter({
  routes
})

export default router
